;; 测试启动时间
(use-package benchmark-init
  :init (benchmark-init/activate)
  :hook (after-init . benchmark-init/deactivate))


;; M-x restart-emacs
(use-package restart-emacs)


;; for exec-path-from-shell
(use-package exec-path-from-shell
  :defer nil
  :if (memq window-system '(mac ns x))
  :init (exec-path-from-shell-initialize))

;; Settings for company
(use-package company
  :diminish (company-mode " Cmp.")
  :defines (company-dabbrev-ignore-case company-dabbrev-downcase)
  :hook (after-init . global-company-mode)
  :config (setq company-dabbrev-code-everywhere t
		        company-dabbrev-code-modes t
		        company-dabbrev-code-other-buffers 'all
		        company-dabbrev-downcase nil
		        company-dabbrev-ignore-case t
		        company-dabbrev-other-buffers 'all
		        company-require-match nil
		        company-minimum-prefix-length 1
		        company-show-numbers t
		        company-tooltip-limit 20
		        company-idle-delay 0
		        company-echo-delay 0
		        company-tooltip-offset-display 'scrollbar
		        company-begin-commands '(self-insert-command))
  ;; (eval-after-load 'company
  ;;   '(add-to-list 'company-backends
  ;;                 '(company-abbrev company-yasnippet company-capf)))
  )


;; Better sorting and filtering
(use-package company-prescient
  :init (company-prescient-mode 1))

;; Settings for highlight parentheses
(use-package highlight-parentheses
  :diminish
  :hook (prog-mode . highlight-parentheses-mode))

(use-package rainbow-delimiters
  :diminish
  :hook (prog-mode . rainbow-delimiters-mode))

;; Beacon mode - highlight the line where your cursor is
(use-package beacon
  :unless *is-windows*
  :hook (after-init . beacon-mode))

;; Indent grade guide line
(use-package indent-guide
  :hook (after-init . indent-guide-global-mode))

;; [built-in] paren mode
(use-package paren
  :ensure nil
  :config (show-paren-mode 1))

;; [built-in] electric-pair
(use-package electric
  :ensure nil
  :hook ((after-init . electric-indent-mode)
	     (prog-mode . electric-pair-mode)))


;; 窗口跳转
(use-package window-numbering
  :init (window-numbering-mode t))


;; bing-dict
(use-package bing-dict
  :init (global-set-key (kbd "C-c d") 'bing-dict-brief))

;; neotree
;; Keybindings
;; Only in Neotree Buffer:
;; n next line, p previous line。
;; SPC or RET or TAB Open current item if it is a file. Fold/Unfold current item if it is a directory.
;; U Go up a directory
;; g Refresh
;; A Maximize/Minimize the NeoTree Window
;; H Toggle display hidden files
;; O Recursively open a directory
;; C-c C-n Create a file or create a directory if filename ends with a ‘/’
;; C-c C-d Delete a file or a directory.
;; C-c C-r Rename a file or a directory.
;; C-c C-c Change the root directory.
;; C-c C-p Copy a file or a directory.
(use-package neotree
  :init (global-set-key [f8] 'neotree-toggle))

;; 一些方便的快捷键
;;(use-package crux
;;  :bind (("C-c k" . crux-smart-kill-line)
;;	 ("C-a" . crux-move-beginning-of-line)
;;	 ("C-x ," . crux-find-user-init-file)
;;	 ("C-S-d" . crux-duplicate-current-line-or-region)))

;; 文本行或块上下移动
(use-package drag-stuff
  :bind (("<M-up>" . drag-stuff-up)
	 ("<M-down>" . drag-stuff-down)))

;; smex
(use-package smex
  :init (smex-initialize)
  :bind (("M-x" . 'smex)
	 ("M-X" . 'smex-major-mode-commands)
	 ("C-c C-c M-x" . 'execute-extended-command)))

;; (use-package paredit)

;; 线性的redo/undo
(use-package undo-fu
  :bind (("C-z" . 'undo-fu-only-undo)
	 ("C-S-z" . 'undo-fu-only-redo)))

;; 注释/反注释
(use-package   smart-comment
  :bind (("C-/" . 'smart-comment)))

;; 书签跳转
;; (use-package bm
;;   :bind (("<C-f2>" . 'bm-toggle)
;; 	 ("<f2>" . 'bm-next)
;; 	 ("<S-f2>" . 'bm-previous)))

;; (use-package goto-chg
;;   :bind (("C-." . 'goto-last-change)
;; 	 ("C-," . 'goto-last-change-reverse)))


;; 光标跳转
;; (use-package detour
;;   :bind
;;   ([(control \.)] . detour-mark)
;;   ([(control \,)] . detour-back))


;; haskell-mode
(use-package haskell-mode)

;; tango-plus-theme
;;(use-package tango-plus-theme
;;  :init (load-theme 'tango-plus t))

;; racket-mode
;;(use-package racket-mode
;;  :config (setq racket-racket-program "Racket"
;;	       racket-raco-program "raco")
;;  :bind (("<f5>" . 'racket-run)))

;; slime
;; (use-package slime
;;   :config (setq inferior-lisp-program "sbcl"))

(use-package racket-mode
  :config (setq racket-racket-program "racket"
		racket-raco-program "raco")
  :bind (("<f5>" . 'racket-run)))


(provide 'init-packages)

	


